﻿using System;
using AzureTracer.Model;
using System.Collections.ObjectModel;
using AzureTracer.Services;

namespace AzureTracer.Design
{
    public class DesignLogService :ILogService
    {

        private ObservableCollection<LogEntity> _logList;

        public DesignLogService()
        {
            _logList = new ObservableCollection<LogEntity>();

            LoadData(null);
        }        

        public ObservableCollection<LogEntity> LogList
        {
            get { return _logList; }
            set { _logList = value; }
        }

        public void LoadData(Action<int, Exception> callback)
        {
            _logList.Add(new LogEntity() { Role = "Role1", Message = "Test Message short", RoleInstance = "Instance1", Timestamp = DateTime.Now, IsRead = false });
            _logList.Add(new LogEntity() { Role = "Role2", Message = "Test Message medium", RoleInstance = "Instance1", Timestamp = DateTime.Now, IsRead = true });
            _logList.Add(new LogEntity() { Role = "Role3", Message = "Test Message large\nHello", RoleInstance = "Instance1", Timestamp = DateTime.Now, IsRead = true });
            callback(3, null);
        }


        public void CheckService(string accountName, string accountKey, Action<Exception> callback)
        {
            throw new NotImplementedException();
        }
    }
}